<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <input type="text" class="user">
    <br>
    <input type="text" class="pwd">
    <br>
    <button class="btn">登录</button>

    <script src="../js/ajax_v3.js"></script>
    <script src="../js/api.js"></script>


    <script>

        const oUser = document.querySelector('.user') ;
        const oPwd = document.querySelector('.pwd') ;
        const oBtn = document.querySelector('.btn') ;

        // oBtn.onclick = function() {
        //     const username = oUser.value ;
        //     const password = oPwd.value ;
        //     login({
        //         username ,
        //         password
        //     }).then(data => {
        //         console.log(data);
        //     })
        // }


        oBtn.onclick = async function() {
            const username = oUser.value ;
            const password = oPwd.value ;
            const res = await login({username , password}) ;
            console.log(res);
            
        }

    </script>

</body>
</html>